package sceneGraph;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;

import Lib3d.Vector3d;

/**
 * 
 * Représente un noeud Translation.
 */
public class SceneTranslationNode extends SceneNode {

	private float translationX = 0;
	private float translationY = 0;
	private float translationZ = 0;
	
	public SceneTranslationNode(float translationX, float translationY, float translationZ) {
		setTranslationX(translationX);
		setTranslationY(translationY);
		setTranslationZ(translationZ);
	}
	
	public SceneTranslationNode(Vector3d bouncingBallCoords) {
		setTranslationX(bouncingBallCoords.get(0));
		setTranslationY(bouncingBallCoords.get(1));
		setTranslationZ(bouncingBallCoords.get(2));
	}
	
	@Override
	public void draw(GLAutoDrawable gLDrawable) {
		GL gl = gLDrawable.getGL();
		gl.glPushMatrix();
		
		gl.glTranslatef(translationX, translationY, translationZ);
		
		super.draw(gLDrawable);
		gl.glPopMatrix();
	}

	public float getTranslationX() {
		return translationX;
	}

	public float getTranslationY() {
		return translationY;
	}

	public float getTranslationZ() {
		return translationZ;
	}

	public void setTranslationX(float translationX) {
		this.translationX = translationX;
	}

	public void setTranslationY(float translationY) {
		this.translationY = translationY;
	}

	public void setTranslationZ(float translationZ) {
		this.translationZ = translationZ;
	}

	public void setTranslation(Vector3d translation) {
		setTranslationX(translation.get(0));
		setTranslationY(translation.get(1));
		setTranslationZ(translation.get(2));
	}
}
